﻿package com.firewolf.iteratorAndComponent.iterator.java.menus;

import java.util.ArrayList;
import java.util.Iterator;

import com.firewolf.iteratorAndComponent.iterator.common.MyMenuItem;

/**
 * 午餐菜单,使用ArrayList实现
 * @author Administrator
 *
 */
public class LunchMenu implements IMenu{
	private ArrayList<MyMenuItem> menuItems;
	public LunchMenu() {
		menuItems = new ArrayList<MyMenuItem>();
		
		addItem("tomato", "this is tomato", true, 8.0);
		addItem("cabbage", "this is cabbage", true, 12.0);
		addItem("fish", "this is fish", false, 16.0);
		addItem("mutton", "this is mutton", false, 8.0);
		
	}
	
	/**
	 * 添加一项
	 * @param name
	 * @param description
	 * @param vegetarian
	 * @param price
	 */
	public void addItem(String name, String description, boolean vegetarian,
			double price){
		MyMenuItem menuItem = new MyMenuItem(name, description, vegetarian, price);
		menuItems.add(menuItem);
	}

	@SuppressWarnings("rawtypes")
	@Override
	public Iterator getIterator() {
		return menuItems.iterator();
	}
}
